package com.jdrx.sw.sewage.dao;

import com.jdrx.sw.sewage.beans.dto.AlarmQueryDTO;
import com.jdrx.sw.sewage.beans.dto.StationIdDTO;
import com.jdrx.sw.sewage.beans.entity.AlarmPO;
import com.jdrx.sw.sewage.beans.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface AlarmDAO {
    int insert(AlarmPO record);

    List<AlarmPO> selectAll();

    Integer selectAlarmNum(@Param("alarmStatus") Integer alarmStatus,
                           @Param("mAlarmStatus") Integer mAlarmStatus,
                           @Param("deviceId") Long deviceId);

    List<AlarmNumTotalVO> countAlarmNum(@Param("stationIds") List<Long> stationIds,
                                        @Param("dataNode") String dataNode);

    List<AlarmVO> selectAlarmByPage(AlarmQueryDTO alarmQueryDTO);

    AlarmDetailVO selectAlarmDetailAndDeviceInfoById(Long alarmId);

    AlarmPO selectAlarmByDeviceIdAndAlarmStatus(@Param("deviceId") Long deviceId,
                                                @Param("alarmStatus") Integer alarmStatus,
                                                @Param("dataNode") String dataNode,
                                                @Param("devType") Integer devType,
                                                @Param("netNum") String netNum);

    void updateAlarmInfoAndLevelAndEndTimeById(AlarmPO alarmPO);

    AlarmPO selectAlarmById(Long alarmId);

    DevicePointVO findDevPointValueByAlarmIdAndDevTypeA(@Param("alarmId") Long alarmId,
                                                        @Param("devType") Integer devType,
                                                        @Param("devPoiId") Long devPoiId);

    Integer selectAlarmByStationId(@Param("stationId") Long stationId,
                                   @Param("key") Integer key,
                                   @Param("alarmType") Long alarmType,
                                   @Param("alarmInfo") String alarmInfo);

    Long selsectNextAlarmId(@Param("dataNode") String dataNode);

    Integer countLastDayAlarmNum(@Param("stationId") Long stationId, @Param("dataNode") String dataNode);

    void deletByDevId(Long deviceId);

    List<AlarmVO> selectAlarmList(@Param("stationId") Long stationId);

    List<AlarmAnalysisVO> AlarmAnalysis(StationIdDTO dto);
}